home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / DOS.SWG / 0064_Extended SearchRec.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  1KB  |  51 lines

  1. {
  2.   OK, here's a problem. FExpand takes Newest.Name and appends it to the
  3.   full CURRENT path, not the path you specified on the command line. You
  4.   have to keep track of that path yourself. Or, here's a unit that might
  5.   help. It's an Expanded Searchrec that returns a full filespec.
  6. }
  7.  
  8. unit EXSRec;
  9. { Written by Steve Rogers - 1994. Released to public domain }
  10.  
  11. interface
  12. uses
  13.   dos;
  14.  
  15. type
  16.   EXSearchRec = record           { EXtended searchrec       }
  17.     name : pathstr;              { fully specified filename }
  18.     dsub : searchrec;            { dos.searchrec            }
  19.   end;
  20.  
  21. procedure ffirst(path : pathstr;attr : word;var dd : EXSearchRec);
  22. procedure fnext(var dd : EXSearchRec);
  23.  
  24. implementation
  25.  
  26. procedure ffirst(path : pathstr;attr : word;var dd : EXSearchRec);
  27. begin
  28.   findfirst(path,attr,dd.dsub);
  29.   if (doserror=0) then with dd do begin
  30.     name:= path;
  31.     while not (name[length(name)] in ['\',':',#0])
  32.       do dec(name[0]);
  33.     name:= name+dsub.name;
  34.   end else dd.name:= '';
  35. end;
  36.  
  37. {----------------------}
  38. procedure fnext(var dd : EXSearchRec);
  39.  
  40. begin
  41.   findnext(dd.dsub);
  42.   if (doserror=0) then with dd do begin
  43.     while not (dd.name[length(dd.name)] in ['\',':',#0])
  44.       do dec(name[0]);
  45.     name:= name+dsub.name;
  46.   end else dd.name:= '';
  47. end;
  48.  
  49. {----------------------}
  50. end.
  51.